###############################################################################
# Condor hard configuaration file. 
# To make this config into effect, restarting condor service is mandatory.
###############################################################################
# Specify this machine as STARTD
DAEMON_LIST = MASTER, STARTD

# Reserve portion of memory to system service
RESERVED_MEMORY = 4000

# Define the sub-condition of matchmaking by resource group
<% if @resource_group == 'atlas_cms' %>
# Specify the Central Manager host
CONDOR_HOST = condorce02.ihep.ac.cn

SUB_START = (Target.AcctGroup == "atlas" || Target.AcctGroup == "cms")
BATCH_ResourceGroup = "atlas_cms"
<% elsif @resource_group == 'belle' %>
# Specify the Central Manager host
CONDOR_HOST = condorce01.ihep.ac.cn

SUB_START = (Target.AcctGroup == "belle")
BATCH_ResourceGroup = "belle"
<% elsif @resource_group == 'juno' %>
# Specify the Central Manager host
CONDOR_HOST = condorce01.ihep.ac.cn

SUB_START = (Target.AcctGroup == "juno")
BATCH_ResourceGroup = "juno"
<% elsif @resource_group == 'cepc_ilc' %>
# Specify the Central Manager host
CONDOR_HOST = condorce01.ihep.ac.cn

SUB_START = (Target.AcctGroup == "cepc" || Target.AcctGroup == "ilc")
BATCH_ResourceGroup = "cepc_ilc"
<% elsif @resource_group == 'lhcb' %>
# Specify the Central Manager host
CONDOR_HOST = condorce01.ihep.ac.cn

SUB_START = (Target.AcctGroup == "lhcb")
BATCH_ResourceGroup = "lhcb"
<% elsif @resource_group == 'lcglhcb' %>
# Specify the Central Manager host
CONDOR_HOST = celhcb01.ihep.ac.cn

SUB_START = (Target.AcctGroup == "lhcb")
BATCH_ResourceGroup = "lhcb"
<% else %>
# Specify the Central Manager host
CONDOR_HOST = condorce01.ihep.ac.cn

SUB_START = True 
BATCH_ResourceGroup = "none"
<% end %>
# Add a new attribute 'IsSamSlot' to simulate a virtual core for running test job
SLOT1_IsSamSlot = false
SLOT2_IsSamSlot = true
STARTD_ATTRS = $(STARTD_ATTRS) BATCH_ResourceGroup IsSamSlot
# Report an extral CPU core to specially run SAM test job
NUM_CPUS = $(DETECTED_CPUS)+1
# Slot type 1 is set for pilot job
NUM_SLOTS_TYPE_1 = 1
SLOT_TYPE_1_PARTITIONABLE = true
SLOT_TYPE_1 = cpus=$(DETECTED_CPUS)
SLOT_1_STARTD_ATTRS = IsSamSlot
# Slot type 2 is set for sam or other test job
NUM_SLOTS_TYPE_2 = 1
SLOT_TYPE_2_PARTITIONABLE = false
SLOT_TYPE_2 = cpus=1,mem=3000
SLOT_2_STARTD_ATTRS = IsSamSlot

# If the matched slot is sam slot, restrict the slot to specific group
START = (My.IsSamSLot ? (Target.AcctGroup == "ops" || Target.AcctGroup == "lcgadmin") : $(SUB_START))

# Redirect EXECUTE directory to /tmp, MOUNT_UNDER_SCRATCH just keep /scratch
# be able to set as EXECUTE, which might only heppen in Version 8.8.4.
MOUNT_UNDER_SCRATCH =
EXECUTE = /scratch/condor
